<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />

		<script src="../js/mui.min.js"></script>
		<script type="text/javascript" src="../js/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../controll/index.js"></script>
		<script type="text/javascript" src="../js/common.js"></script>
	</head>
	<style>
		* {
			margin: 0;
			padding: 0;
		}
		
		a {
			text-decoration: none;
		}
		
		ul,
		li,
		ol {
			list-style: none;
		}
		
		#head {
			width: 100%;
			position: relative;
		}
		
		#head span {
			position: absolute;
			right: 15px;
			top: 0;
		}
		
		#head img {
			display: block;
			width: 80px;
			height: 80px;
			margin: 0 auto;
		}
		
		#head p {
			text-align: center;
			font-size: 16px;
			color: rgb(18, 150, 219);
			width: 90%;
			margin: 15px auto;
		}
		
		#head #price {
			font-size: 30px;
			color: #000;
			padding-bottom: 30px;
			border-bottom: 1px solid #C6C6C6;
		}
		
		#info {
			padding: 0 15px;
			position: relative;
		}
		
		.price {
			position: absolute;
			right: 15px;
		}
		
		.priceType {
			margin-left: 15px;
			color: #666;
			font-family: "微软雅黑";
		}
		
		.detail {
			padding: 15px;
			color: rgb(18, 150, 219);
			text-align: center;
			margin-top: 30px;
			font-size: 14px;
		}
	</style>

	<body>

		<div style="width: 100%; height:20px;"></div>
		<div id="head">
			<span class="mui-pull-right">完成</span>
			<img class="bg" src="../img/cg2.png" />
			<p>支付成功</p>
			<p id="price"></p>
		</div>
		<span id="info">付款信息</span><span class="priceType">余额宝</span><span class="price">0.01</span>
		<p class="detail">点此查看订单详情</p>

		<script type="text/javascript">
			mui.init();
			mui.plusReady(function() {
				//console.log(localStorage.getItem("tradeDetail"));
				var tradeDetail = JSON.parse(localStorage.getItem("tradeDetail"));
				var string = "\n       新天元大酒店                           ";
				string += "\n===========================\n";
				string += "\n交易订单号：" + tradeDetail.out_trade_no + "     \n";
				string += "\n交易流水号：" + tradeDetail.trade_no + "     \n"
				string += "\n时间：" + getNowFormatDate() + "     \n";
				string += "\n消费金额:" + localStorage.getItem("price") + " 元 \n\n";
				string += "\n===========================\n";
				string += "\n     天择可付  智慧收银       \n\n\n\n";
				var reg=/\\n/g;
				var str=tradeDetail.print_content
				str=str.replace(reg,'\n');
				console.log(string);
				console.log(str);
//				str=tradeDetail.print_content;
//				
				$(".detail").attr("data-num", tradeDetail.out_trade_no);
				$("#price, .price").html(localStorage.getItem("price") + "元");
				if(localStorage.getItem("video") == 1) {
					video("成功到账" + char_zh(localStorage.getItem("price")) + "元");
					print(str);
					localStorage.setItem("video","0");
				}

				//			function getNowFormatDate() {
				//				var date = new Date();
				//				var seperator1 = "-";
				//				var seperator2 = ":";
				//				var month = date.getMonth() + 1;
				//				var strDate = date.getDate();
				//				if(month >= 1 && month <= 9) {
				//					month = "0" + month;
				//				}
				//				if(strDate >= 0 && strDate <= 9) {
				//					strDate = "0" + strDate;
				//				}
				//				var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +
				//					" " + date.getHours() + seperator2 + date.getMinutes() +
				//					seperator2 + date.getSeconds();
				//				return currentdate;
				//			}

				mui("body").on("tap", ".detail", function() {
					localStorage.getItem("orderNum", $(this).attr("data-num"));
					mui.openWindow({
						url: '../view/detail.html',
						id: "detail"
					});
				})
				mui("body").on("tap", ".mui-pull-right", function() {
					mui.openWindow({
						url: '/view/pay.html',
						id: "pay"
					});
				})
			})
		</script>
	</body>

</html>